package ru.ifmo.fgrammar;

public class Token {
    public enum TokenType {
        NOT_DEFINED,
        IDENTIFIER, 
        LITERAL_INT,
        LITERAL_REAL,
        LITERAL_STRING,
        KEYWORD_IF, 
        KEYWORD_THEN, 
        KEYWORD_ELSE, 
        KEYWORD_WHILE, 
        KEYWORD_NEW, 
        KEYWORD_REPLACESTR, 
        KEYWORD_FINDSTR, 
        KEYWORD_SUBSTR, 
        KEYWORD_STRLEN, 
        COMMENT, 
        PREFIX_OP,
        POSTFIX_OP,
        INFIX_OP,
        RELATION_OP, 
        ASSIGNMENT_OP, 
        COMMA, 
        BRACE_OPEN, 
        BRACE_CLOSE, 
        BRACKET_OPEN, 
        BRACKET_CLOSE, 
        SEMICOLON        
    }

    /**
     * Type of the token 
     */
    public TokenType type;

    /**
     * Index in the identifier table
     */
    public int idx;

    /**
     * Value (for tokens like "RELATION_OPERATOR")
     */
    public String value;

    /**
     * Constructor
     * @param type Token type
     * @param idx Index in id table
     * @param value String value
     */
    public Token(TokenType type, int idx, String value) {
        this.type = type;
        this.idx = idx;
        this.value = value;
    }
}
